
let mongoose = require("mongoose");

let {Schema,model} = mongoose;

let UserSchema = new Schema({
    user:{
        type:String,
        match:/^[a-zA-Z_\u4e00-\u9fa5][\w\u4e00-\u9fa5]{5,11}$/,  // 中英文均可 6-12位,
        require:true,
        unique:true,
    },
    pwd:{
        type:String,
        match:/^\w{6,12}$/,  // 6-12位,
        require:true,
    },
    phone:{
        type:String,
        match:/^1[3-9]\d{9}$/,  
        require:true,
        unique:true,
    },
    email:{
        type:String,
        match:/^\w+@\w+\.\w+$/,  
        require:true,
        unique:true,
    },
})


let User = model("user",UserSchema);

module.exports = User;